<?php

// MD5加密
if(!function_exists("md5Password"))
{
    function md5Password($pwd){

        $str = "vejaoijfij321FJAI";

        return md5($str.md5($pwd));
    }
}

// 前台md5加密
if(!function_exists("indexpassword")){
    function indexpwd($pwd){
        $code = "asdff213adsxcASD";

        return md5($pwd.$code);
    }
}

// 无线级分类函数
if(!function_exists("getTree"))
{
    function getTree($arr,$pid=0,$level=0)
    {
        static $categroy = [];

        foreach($arr as $v)
        {
            if($v['pid'] == $pid){

                $v['level'] = $level;

                $categroy[] = $v;

                getTree($arr,$v['id'],$level+1);
            }
        }
        return $categroy;
    }
}